<%--
 *  File:   specailCharSummary.jsp
 *  Desc:	
 *
 *  Date	  :	 2013-10-30     
 *  Author	:  jeanhuang
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
	//init param
  String strModuleName = "IMG";
  String privilegeCode = "IMG0303";
  String contextPath = request.getContextPath();
  
  String struploadcolumnconfigid=request.getParameter("uploadcolumnconfigid")+"";
  if(session.getAttribute("uploadcolumnconfigid")!=null){
		struploadcolumnconfigid=session.getAttribute("uploadcolumnconfigid")+"";
	}
%>


<html>
<head>
<title>specailCharSummary</title>
<PageFlow:CheckPageFlow pageName="p_specailchar"/>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/AlertError.inc" %>
<%@ include file="/inc/SummaryDivision.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<%
    String displayflag = null;
    if(request.getParameter("displayflag")!=null&&request.getParameter("displayflag").length()!=0)
        displayflag=request.getParameter("displayflag");
    if(displayflag==null && session.getAttribute("displayflag")!=null)
        displayflag = (String)session.getAttribute("displayflag");
    boolean isView = "view".equalsIgnoreCase(displayflag);
    boolean isEdit = "edit".equalsIgnoreCase(displayflag);
    String needClass = isView?"td-text":"need";
    String needClassOnce = (isView||isEdit)?"td-text":"need";
%>

<%
  Vector sepecialchardatas = (Vector)pageContext.getAttribute("sepecialchardatas");

  if(sepecialchardatas == null) sepecialchardatas = new Vector();

%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript">

function clickComboCode(id)
{
  document.cform.id.value = id;
}

function page_add()
{
    //if(!checkALLElems(document.getElementById("newdetail"))) return;
    if(!checkForm(cform)) return;
    emptyToNull(cform);
    
    var sortno=document.cform.sortno.value;
    if((!isPositive(sortno))||(!isInteger(sortno))){
    	alert("<%= message.getMessageDesc("SEQUENCE_MUST_POSITION",label.getLabelName("L_SerialCode"))%>");
    	return;
    }
    
    cform.actionname.value = "add";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_delete()
{
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "specailCharSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}



function page_update()
{ 
   /* var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	for(var j = 0 ; j < length;j++){
		  var sortno=document.cform.sortno.value;
    if((!isPositive(sortno))||(!isInteger(sortno))){
    	alert("<%= message.getMessageDesc("SEQUENCE_MUST_POSITION",label.getLabelName("L_SerialCode"))%>");
    	return;
    }
	}*/
	emptyToNull(document.cform);
    cform.actionname.value = "savevec";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}


function page_close(){
	window.close();
}

</script>
<body>
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher" >
  <input type="hidden" name="pagename" value="p_specailchar">
  <input type="hidden" name="actionname">
   <custom:hidden property="displayflag" value="<%=displayflag %>"></custom:hidden>
  <custom:hidden property="uploadcolumnconfigid" value="<%=struploadcolumnconfigid %>" />

<table border=0 cellpadding=0 cellspacing=0 width="100%">
  <tr>
    <td valign=top>
      <table border=0 cellpadding=1 cellspacing=0 width="100%">
        <tr>
          <td bgcolor=#000000 style="PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 0px">
            <table bgcolor=#000000 border=0 cellpadding=0 cellspacing=0 width="100%">
              <tr>
                <td  bgcolor=#ffffff style="PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; PADDING-TOP: 3px">
                    <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
<tr  class="deepblue-left"> 
	<td width="5%" class="title_center">&nbsp;</td>
	<td width="15%" class="title_center"><%= label.getLabelName("L_SerialCode") %></td>
	<td width="10%" class="title_center"><%= label.getLabelName("L_SourceCharRule") %><font color="red">*</font></td>
	<td width="20%" class="title_center"><%= label.getLabelName("L_TargetChar") %><font color="red">*</font></td>
		
</tr>
<span id="olddetail" >
				 		  <%
				             int j = 0;
				             String strClassType = new String();
				             Integer nDefaultId = new Integer(-1);
				             boolean bHasChecked = false;
				          %>
                    <logic:iterate id="onerows" collection="<%= sepecialchardatas %>" indexId="idx">
                        <%
				            HashMap hashdatas = (HashMap)pageContext.getAttribute("onerows");
				
				            String strIsDisabled = new String("");
				            String strIsChecked = new String("");
				
				            if(j%2 == 1){
				              strClassType = "td-listrom";
				            }else{
				              strClassType = "";
				            }
				           if(!bHasChecked)
				            {
				              strIsChecked = "Checked";
				              bHasChecked = true;
				              nDefaultId = (Integer)(hashdatas.get("uploadcolumnreplacesid"));
				            }
				            j++;
         			 %>
         			 <% if(!isView){%>
         			 <tr>
                        <td width="30">
                        <input id="deletes<%=JspHelper.filterNull(j)%>" type="radio" name="checkdept"  value=<%=JspHelper.filterNull( hashdatas.get("uploadcolumnreplacesid") )%> class="checkbox" <%=JspHelper.filterNull( strIsChecked)%> onClick="javascript:clickComboCode('<%=JspHelper.filterNull( hashdatas.get("uploadcolumnreplacesid") )%>')">
                        <custom:hidden property="uploadcolumnreplacesid" name="onerows" colIndex="<%=idx %>"></custom:hidden>
                        </td>
                        <td><custom:text property="sortno" name="onerows" colIndex="<%=idx %>" command="notnull" label="L_SerialCode" /></td>
                        <td>
                        <custom:text property="sourcechars" name="onerows" colIndex="<%=idx %>" command="notnull" label="L_SourceCharRule" />
                        </td>
                        <td><custom:text property="targetchars" name="onerows" colIndex="<%=idx %>" maxlength="1" /></td>
                   </tr>
                   <%}else{ %>
                   
                      <tr>
                        <td width="30">
                        <input id="deletes<%=JspHelper.filterNull(j)%>" type="radio" name="checkdept"  value=<%=JspHelper.filterNull( hashdatas.get("uploadcolumnreplacesid") )%> class="checkbox" <%=JspHelper.filterNull( strIsChecked)%> onClick="javascript:clickComboCode('<%=JspHelper.filterNull( hashdatas.get("uploadcolumnreplacesid") )%>')">
                        </td>
                        <td><custom:write property="sortno" name="onerows"  nbsp="true"/></td>
                        <td>
                        <custom:write property="sourcechars" name="onerows" nbsp="true" />
                        </td>
                        <td><custom:write property="targetchars" name="onerows" nbsp="true" /></td>
                   </tr>
                   <%} %>
                      
                      </logic:iterate>
                      <input type=hidden name="numrows" value="<%=JspHelper.filterNull(sepecialchardatas.size())%>">

 <% if(!isView){%>
<span id="newdetail" >
                      <tr >
                        <td>&nbsp;</td>
                        
                        <td>
                       		<custom:text name="newdata" property="sortno" command="notnull" label="L_SerialCode"  />
                        </td>
                        
                      
                        <td>
							<custom:text name="newdata" property="sourcechars" command="notnull" label="L_SourceCharRule" />
                  		</td>
                  		<td>
             		    	<custom:text name="newdata" property="targetchars" maxlength="1" />
                        </td>

                        
                      </tr>

</span>
<%} %>
<%@ include file="/inc/SummaryAction.inc" %>
</span>
  <custom:hidden property="id" value="<%=JspHelper.filterNull( nDefaultId )+"" %>" />

                    </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
         <tr><td class="summary_top"></td></tr>
         
         <tr>
           <td class="td_center">
          <% if(!isView){%>
          	  <a onclick="page_add();"><custom:button type="1" label="L_Add" imgsrc="new.gif" border="0" style="width:60"/></a>
          	  <a onclick="page_update();"><custom:button type="1" label="L_Save" imgsrc="new.gif" border="0" style="width:60"/></a>
              <a onclick="page_delete();"><custom:button type="1" label="L_Delete" imgsrc="new.gif" border="0" style="width:60"/></a>
          <%} %>
          <a onclick="page_close();"><custom:button type="1" label="L_Close" imgsrc="new.gif" border="0" style="width:60"/></a>
           </td>
         </tr>
        
      </table>
    </td>
  </tr>
</table>
</form>
</body>

</html>